<%--
  Created by IntelliJ IDEA.
  User: bbb304
  Date: 2025/11/2
  Time: 14:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>员工管理</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body>
<div class="container">
    <header>
        <h1>员工信息管理系统</h1>
        <div class="user-info">
            欢迎, ${sessionScope.username} |
            < a href=" ">退出</ a>
</div>
</header>

<nav>
    <ul>
        <li>< a href="${pageContext.request.contextPath}/dashboard">首页</ a></li>
        <li>< a href="${pageContext.request.contextPath}/employees" class="active">员工管理</ a></li>
    </ul>
</nav>

<main>
    <div class="page-header">
        <h2>员工列表</h2>
        < a href="${pageContext.request.contextPath}/employees?action=new" class="btn btn-primary">添加员工</ a>
    </div>

    <c:if test="${not empty message}">
        <div class="success-message">${message}</div>
    </c:if>

    <table class="data-table">
        <thead>
        <tr>
            <th>ID</th>
            <th>姓名</th>
            <th>部门</th>
            <th>职位</th>
            <th>薪资</th>
            <th>入职日期</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <c:forEach var="employee" items="${employees}">
            <tr>
                <td>${employee.id}</td>
                <td>${employee.name}</td>
                <td>${employee.department}</td>
                <td>${employee.position}</td>
                <td>¥${employee.salary}</td>
                <td>${employee.hireDate}</td>
                <td class="actions">
                    < a href="${pageContext.request.contextPath}/employees?action=edit&id=${employee.id}" class="btn btn-edit">编辑</ a>
                < a href="${pageContext.request.contextPath}/employees?action=delete&id=${employee.id}"
                class="btn btn-delete"
                onclick="return confirm('确定要删除这个员工吗？')">删除</ a>
            </td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</main>
</div>
</body>
</html>
